package com.zoe.onelink.business.util.ws.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.zoe.onelink.business.util.XmlUtil;

/**
 * <p>标题: 请求消息实体</p>
 * <p>描述: 请求头+请求体</p>
 * <p>版权: Copyright (c) 2016</p>
 * <p>公司: 智业软件股份有限公司</p>
 * @version: 1.0
 * @author: cxy
 * @date 2016/12/21
 */
@XStreamAlias("root")
public class BaseMessage {

    @XStreamAlias("msgHeader")
    private Header msgHeader;

    @XStreamAlias("msgBody")
    private Body msgBody;

    public Header getMsgHeader() {
        return msgHeader;
    }

    public void setMsgHeader(Header msgHeader) {
        this.msgHeader = msgHeader;
    }

    public Body getMsgBody() {
        return msgBody;
    }

    public void setMsgBody(Body msgBody) {
        this.msgBody = msgBody;
    }

    public String getXml() {
        try {
            String declaration = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
            return declaration + XmlUtil.toXml(this);
        } catch (Exception e) {
            return null;
        }
    }
}
